***********************************************
***********ESS cumulative Waves 1-9************
***********************************************
***********Social Contract*********************
clear
set more off
** use "/ESS1-9e01_1.dta"

**Dependent variable***
*1 if vote for far right; 0 otherwise 

local varlist prtvtat - prtvtdsk
gen vright=.
replace vright=1 if /*austria*/ prtvtat==3| prtvtaat==3| prtvtaat==4| prtvtbat==3| prtvtbat==4| prtvtcat==3|/*
belgium*/ prtvtbe==8| prtvtabe==7| prtvtbbe==7| prtvtcbe==7|prtvtdbe==7|/*
belgiumFN*/ prtvtbe==15 | prtvtabe==11 | prtvtbbe==11 | prtvtcbe==11| prtvtdbe==11|/*
Bulgaria*/prtvtbg==10| prtvtabg==10| prtvtbbg==5| prtvtcbg==3| prtvtdbg==3| /*
cyprus*/prtvtbcy==4|/**//*Denmark*/prtvtdk==6| prtvtadk==6| prtvtbdk==5| prtvtcdk==5|prtvtddk==5|/*
Estonia*/prtvtee==9|  prtvtbee==9| prtvtcee==8| prtvtdee==8| prtvteee==9| prtvtfee==9 | prtvtgee==6 | /*
Finland*/prtvtfi==5| prtvtafi==5| prtvtbfi==5| prtvtcfi==4| prtvtdfi==4 |prtvtdfi==4|/*
France*/prtvtfr==3| prtvtafr==3| prtvtbfr==2| prtvtcfr==2|prtvtdfr==11| /*
FranceMNR*/prtvtfr==7| prtvtafr==7|/*
Germany*/prtvede1==6 | prtvede2==6 |/*
greece*/prtvtagr==6|prtvtbgr==5|prtvtcgr==4|prtvtcgr==10|/*
hungary*/ prtvtahu==3| prtvtbhu==3| prtvtchu==11| prtvtdhu==4| prtvtehu==2|prtvtfhu==4| prtvtfhu==3|/*
Italy*/prtvtit==11| prtvtit==9| prtvtit==16| prtvtbit==9| prtvtcit==9| prtvtcit==10|/*
Latvia not in ess*//*Lithuania*/ prtvlt1==13|  prtvalt1==9| prtvblt1==5 | prtvlt2==14| prtvalt2==9| prtvblt2==6 | prtvlt3==14| prtvalt3==9| prtvblt3==6|/*
Luxemberg no far right in ess*//*Malta not in ess*//*Netherlands*/prtvtnl==4| prtvtanl==4| prtvtbnl==4| prtvtcnl==4| prtvtdnl==3| prtvtenl==3| prtvtfnl==3| prtvtgnl==3|/*
Poland*/prtvtpl==5| prtvtpl==10| prtvtapl==14| prtvtapl==3| prtvtbpl==2 |prtvtbpl==6|prtvtcpl==6|prtvtcpl==1| prtvtdpl==6 | prtvtdpl==1 |/*
Portugal*/prtvtpt==7 |prtvtapt==8 |prtvtbpt== 8| prtvtcpt==11 |/*
Slovakia*/prtvtask==6| prtvtbsk==1| prtvtdsk==2| /*
Slovenia*/prtvtsi==4 |prtvtasi==6 |prtvtbsi==4| prtvtcsi==7 |prtvtdsi==10| prtvtfsi==1|/*
Spain*/ prtvtees==16|/*
Sweden*/prtvtase== 10| prtvtbse== 10| prtvtcse==9| /*UK*/ prtvtagb==7|prtvtagb==8| prtvtbgb==7|prtvtcgb==7|/*
Switzerland*/prtvtch==4|prtvtach==4|prtvtbch==4|prtvtcch==4|prtvtdch==1|prtvtech==1|prtvtfch==1|prtvtch==11 |prtvtach==11 |prtvtbch==10|prtvtcch==10|prtvtdch==15|prtvtgch==1| /*
Norway*/ prtvtno==8|prtvtano==8|prtvtbno==8 | /* Czechia*/ prtvtecz==8

foreach var of varlist prtvtat - prtvtdsk {
replace vright=0 if `var'!=. & vright !=1
}



label variable vright "voted far-right in the last election"

tab vright

**Independent variables 

*Satisfaction with economy, government and democracy // 0 to 10 scale high=satisfied 
*alpha stfeco stfgov stfdem --> Cronbach's alpha =  0.83
sumscale, f1(stfeco stfgov stfdem)
gen satSC = Factor1_average
sum satSC
label var satSC "Performance Satisfaction"

*State of education  // what you think overall about the state of education in [country] nowadays
gen stateEDU = stfedu // 0-10: high = good
sum stateEDU
tab stateEDU
label var stateEDU "State of Education"

*State of health // what you think overall about the state of health services in [country] nowadays?
gen stateHEALTH = stfhlth // 0-10: high = good
tab stateHEALTH
sum stateHEALTH
label var stateHEALTH "State of Health"

*Trust in domestic institutions // parliament // legal system // police // politicians // political parties 
*alpha trstprl trstlgl trstplc trstplt trstprt --> Cronbach's alpha =  0.89
sumscale, f2(trstprl trstlgl trstplc trstplt trstprt)
gen trust=Factor2_average // high = trust
sum trust
label var trust "Trust in institutions"


*Controls 
* Feeling about household's income nowadays
codebook hincfel
gen feelincome=hincfel // 1 - 4 = low confortable; high difficult  

*Unemployed 
tab uempli // Unemployed, wanting a job but not actively looking for a job
tab uempla //Unemployed and actively looking for a job 
gen unemployed=1 if uempli==1 
replace unemployed=0 if uempli==0 
replace unemployed=1 if uempla==1
tab unemployed

*Immigration (imbgeco: immigration bad for economy; imueclt: immigration unermines culture;  imwbcnt: immigration place to live)
sumscale, f3(imbgeco imueclt imwbcnt) // Cronbach's alpha =  0.85
gen immigration=Factor3_average // high: pro-immigration 
sum immigration

*age
des agea
sum agea
label var agea "Age"

*years in education
des eduyrs
sum eduyrs
label var eduyrs "Years of edu"

*gender
tab gndr, nolabel
recode gndr (1=1) (2=0) (9=.), gen(male)
label variable male "Male"
tab male

*rural/urban
codebook domicil
gen urban=.
replace urban=1 if domicil==1|domicil==2
replace urban=0 if domicil>2
label define urban 0 "rural" 1 "urban"
label values urban urban
tab urban


*left-right
sum lrscale // 0-10: high = right
label variable lrscale "LeftRight"

**Country rounds 
tab cntry essround

gen countryround=.


replace countryround=1 if cntry=="AT" & essround==1
replace countryround=2 if cntry=="AT" & essround==2
replace countryround=3 if cntry=="AT" & essround==3
replace countryround=4 if cntry=="AT" & essround==7
replace countryround=5 if cntry=="AT" & essround==8
replace countryround=6 if cntry=="BE" & essround==1
replace countryround=7 if cntry=="BE" & essround==2
replace countryround=8 if cntry=="BE" & essround==3
replace countryround=9 if cntry=="BE" & essround==4
replace countryround=10 if cntry=="BE" & essround==5
replace countryround=11 if cntry=="BE" & essround==6
replace countryround=12 if cntry=="BE" & essround==7
replace countryround=13 if cntry=="BE" & essround==8
replace countryround=14 if cntry=="BG" & essround==3
replace countryround=15 if cntry=="BG" & essround==4
replace countryround=16 if cntry=="BG" & essround==5
replace countryround=17 if cntry=="BG" & essround==6
replace countryround=18 if cntry=="CH" & essround==1
replace countryround=19 if cntry=="CH" & essround==2
replace countryround=20 if cntry=="CH" & essround==3
replace countryround=21 if cntry=="CH" & essround==4
replace countryround=22 if cntry=="CH" & essround==5
replace countryround=23 if cntry=="CH" & essround==6
replace countryround=24 if cntry=="CH" & essround==7
replace countryround=25 if cntry=="CH" & essround==8
replace countryround=26 if cntry=="DE" & essround==1
replace countryround=27 if cntry=="DE" & essround==2
replace countryround=28 if cntry=="DE" & essround==3
replace countryround=29 if cntry=="DE" & essround==4
replace countryround=30 if cntry=="DE" & essround==5
replace countryround=31 if cntry=="DE" & essround==6
replace countryround=32 if cntry=="DE" & essround==7
replace countryround=33 if cntry=="DE" & essround==8
replace countryround=34 if cntry=="DK" & essround==1
replace countryround=35 if cntry=="DK" & essround==2
replace countryround=36 if cntry=="DK" & essround==3
replace countryround=37 if cntry=="DK" & essround==4
replace countryround=38 if cntry=="DK" & essround==5
replace countryround=39 if cntry=="DK" & essround==6
replace countryround=40 if cntry=="DK" & essround==7
replace countryround=41 if cntry=="FI" & essround==1
replace countryround=42 if cntry=="FI" & essround==2
replace countryround=43 if cntry=="FI" & essround==3
replace countryround=44 if cntry=="FI" & essround==4
replace countryround=45 if cntry=="FI" & essround==5
replace countryround=46 if cntry=="FI" & essround==6
replace countryround=47 if cntry=="FI" & essround==7
replace countryround=48 if cntry=="FI" & essround==8
replace countryround=49 if cntry=="FR" & essround==1
replace countryround=50 if cntry=="FR" & essround==2
replace countryround=51 if cntry=="FR" & essround==3
replace countryround=52 if cntry=="FR" & essround==4
replace countryround=53 if cntry=="FR" & essround==5
replace countryround=54 if cntry=="FR" & essround==6
replace countryround=55 if cntry=="FR" & essround==7
replace countryround=56 if cntry=="FR" & essround==8
replace countryround=57 if cntry=="GB" & essround==1
replace countryround=58 if cntry=="GB" & essround==2
replace countryround=59 if cntry=="GB" & essround==3
replace countryround=60 if cntry=="GB" & essround==4
replace countryround=61 if cntry=="GB" & essround==5
replace countryround=62 if cntry=="GB" & essround==6
replace countryround=63 if cntry=="GB" & essround==7
replace countryround=64 if cntry=="GB" & essround==8
replace countryround=65 if cntry=="GR" & essround==1
replace countryround=66 if cntry=="GR" & essround==2
replace countryround=67 if cntry=="GR" & essround==4
replace countryround=68 if cntry=="GR" & essround==5
replace countryround=69 if cntry=="HU" & essround==1
replace countryround=70 if cntry=="HU" & essround==2
replace countryround=71 if cntry=="HU" & essround==3
replace countryround=72 if cntry=="HU" & essround==4
replace countryround=73 if cntry=="HU" & essround==5
replace countryround=74 if cntry=="HU" & essround==6
replace countryround=75 if cntry=="HU" & essround==7
replace countryround=76 if cntry=="HU" & essround==8
replace countryround=77 if cntry=="IT" & essround==1
replace countryround=78 if cntry=="IT" & essround==6
replace countryround=79 if cntry=="IT" & essround==8
replace countryround=80 if cntry=="LT" & essround==5
replace countryround=81 if cntry=="LT" & essround==6
replace countryround=82 if cntry=="LT" & essround==7
replace countryround=83 if cntry=="LT" & essround==8
replace countryround=84 if cntry=="NL" & essround==1
replace countryround=85 if cntry=="NL" & essround==2
replace countryround=86 if cntry=="NL" & essround==3
replace countryround=87 if cntry=="NL" & essround==4
replace countryround=88 if cntry=="NL" & essround==5
replace countryround=89 if cntry=="NL" & essround==6
replace countryround=90 if cntry=="NL" & essround==7
replace countryround=91 if cntry=="NL" & essround==8
replace countryround=92 if cntry=="NO" & essround==1
replace countryround=93 if cntry=="NO" & essround==2
replace countryround=94 if cntry=="NO" & essround==3
replace countryround=95 if cntry=="NO" & essround==4
replace countryround=96 if cntry=="NO" & essround==5
replace countryround=97 if cntry=="NO" & essround==6
replace countryround=98 if cntry=="NO" & essround==7
replace countryround=99 if cntry=="NO" & essround==8
replace countryround=100 if cntry=="PL" & essround==1
replace countryround=101 if cntry=="PL" & essround==2
replace countryround=102 if cntry=="PL" & essround==3
replace countryround=103 if cntry=="PL" & essround==4
replace countryround=104 if cntry=="PL" & essround==5
replace countryround=105 if cntry=="PL" & essround==6
replace countryround=106 if cntry=="PL" & essround==7
replace countryround=107 if cntry=="PL" & essround==8
replace countryround=108 if cntry=="SE" & essround==1
replace countryround=109 if cntry=="SE" & essround==2
replace countryround=110 if cntry=="SE" & essround==3
replace countryround=111 if cntry=="SE" & essround==4
replace countryround=112 if cntry=="SE" & essround==5
replace countryround=113 if cntry=="SE" & essround==6
replace countryround=114 if cntry=="SE" & essround==7
replace countryround=115 if cntry=="SE" & essround==8
replace countryround=116 if cntry=="SI" & essround==1
replace countryround=117 if cntry=="SI" & essround==2
replace countryround=118 if cntry=="SI" & essround==3
replace countryround=119 if cntry=="SI" & essround==4
replace countryround=120 if cntry=="SI" & essround==5
replace countryround=121 if cntry=="SI" & essround==6
replace countryround=122 if cntry=="SI" & essround==7
replace countryround=123 if cntry=="SI" & essround==8
replace countryround=124 if cntry=="SK" & essround==2
replace countryround=125 if cntry=="SK" & essround==3
replace countryround=126 if cntry=="SK" & essround==4
replace countryround=127 if cntry=="SK" & essround==5
replace countryround=128 if cntry=="SK" & essround==6
replace countryround=129 if cntry=="EE" & essround==2
replace countryround=130 if cntry=="EE" & essround==3
replace countryround=131 if cntry=="EE" & essround==4
replace countryround=132 if cntry=="EE" & essround==5
replace countryround=133 if cntry=="EE" & essround==6
replace countryround=134 if cntry=="EE" & essround==7
replace countryround=135 if cntry=="EE" & essround==8
replace countryround=136 if cntry=="PT" & essround==1
replace countryround=137 if cntry=="PT" & essround==2
replace countryround=138 if cntry=="PT" & essround==3
replace countryround=139 if cntry=="PT" & essround==4
replace countryround=140 if cntry=="PT" & essround==5
replace countryround=141 if cntry=="PT" & essround==6
replace countryround=142 if cntry=="PT" & essround==7
replace countryround=143 if cntry=="PT" & essround==8
replace countryround=144 if cntry=="AT" & essround==9
replace countryround=145 if cntry=="BE" & essround==9
replace countryround=146 if cntry=="BG" & essround==9
replace countryround=147 if cntry=="CY" & essround==9
replace countryround=148 if cntry=="CZ" & essround==9
replace countryround=149 if cntry=="DK" & essround==9
replace countryround=150 if cntry=="EE" & essround==9
replace countryround=151 if cntry=="FI" & essround==9
replace countryround=152 if cntry=="FR" & essround==9
replace countryround=153 if cntry=="DE" & essround==9
replace countryround=154 if cntry=="HU" & essround==9
replace countryround=155 if cntry=="IT" & essround==9
replace countryround=156 if cntry=="LT" & essround==9
replace countryround=157 if cntry=="NL" & essround==9
replace countryround=159 if cntry=="NO" & essround==9
replace countryround=159 if cntry=="PL" & essround==9
replace countryround=160 if cntry=="SK" & essround==9
replace countryround=161 if cntry=="SI" & essround==9
replace countryround=162 if cntry=="ES" & essround==9
replace countryround=163 if cntry=="SE" & essround==9
replace countryround=164 if cntry=="CH" & essround==9
replace countryround=165 if cntry=="GB" & essround==9


label var countryround "Country x ESSround"


*Drop country waves with 0 vright observations 
drop if countryround==57 | countryround==58 | countryround==60 | countryround==61 | countryround==62 | countryround==65 | countryround==69 | countryround==70 | countryround==108 | countryround==109 | countryround==110 | countryround==111 | countryround==122 | countryround==123 | countryround==124 | countryround==128 | countryround==129 | countryround==130 | countryround== 136 | countryround==137 | countryround==138 | countryround==141

*Drop country waves with 0.1-1 per cent observations
drop if countryround==26 | countryround==28 | countryround==29 | countryround==30 | countryround==31 | countryround==41 | countryround==42 | countryround==43 | countryround==59 | countryround==66 | countryround==71 | countryround==72 | countryround==78 | countryround==121 | countryround==131 | countryround==132 | countryround==133 | countryround==134 | countryround==135 | countryround==139 | countryround==140 | countryround==142 | countryround==143

*Drop country waves with 1.01-2 per cent observations
drop if countryround==12 | countryround==13 | countryround==17 | countryround==27 | countryround==52 | countryround==87 | countryround==116 | countryround==120  | countryround==127


*************************************************************************************

****PAPER*********
*We exclude parties with less than 2 per cent observations of far-right voting in each country sample

*****FIGURE 1******

 *Trust  
 
 twoway (hist trust if vright==1, percent lcolor(gs12) fcolor(gs12)) (hist trust if vright==0, percent fcolor(none) lcolor(red)), ///
 legend(off) xtitle("Far right voters (red: Non-far right voters)") title("Trust")

 *Performance_Satisfaction
  twoway (hist satSC if vright==1, percent lcolor(gs12) fcolor(gs12)) (hist satSC if vright==0, percent fcolor(none) lcolor(red)), ///
 legend(off) xtitle("Far right voters (red: Non-far right voters)") title("Performance Satisfaction") 
 
 
 *State of health  

  twoway (hist stateHEALTH if vright==1, percent lcolor(gs12) fcolor(gs12) discrete) (hist stateHEALTH if vright==0, percent fcolor(none) lcolor(red) discrete), ///
 legend(off) xtitle("Far right voters (red: Non-far right voters)") title("State of Health") xlabel(0(1)10)
 
 
 *State of education  
 
  twoway (hist stateEDU if vright==1, percent lcolor(gs12) fcolor(gs12) discrete) (hist stateEDU if vright==0, percent fcolor(none) lcolor(red) discrete), ///
 legend(off) xtitle("Far right voters (red: Non-far right voters)") title("State of Education") xlabel(0(1)10)
  

graph combine "Trust" "Satisfaction" "Health" "Edu"


 *t tests 
 
 ttest trust, by(vright)
 ttest satSC, by(vright)
 ttest stateHEALTH, by(vright)
 ttest stateEDU, by(vright)
 

****FIXED EFFECTS MODELS***********

*Test for multicollinearity btw IVs

corr vright satSC stateEDU stateHEALTH trust feelincome unemployed immigration agea eduyrs male lrscale 
collin vright satSC stateEDU stateHEALTH trust feelincome unemployed immigration agea eduyrs male lrscale 
//Tolerance of 0.1 or less (i.e. VIF of 10 or greater) is a cause for concern 
//(see http://www.ats.ucla.edu/stat/stata/webbooks/logistic/chapter3/statalog3.htm).

*simple models stepwise 

set scheme s1color

*Table 1 

eststo clear

eststo:logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

estimates table M1 M2 M3 M4 M5 M6 M7, b(%7.3f) se(%7.3f) stats(N r2)


 
**** Interactions + marginsplots for Figure 2 [AND APPENDIX TABLE 3]

eststo clear 
eststo:logit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

margins, dydx(trust) at(immigration=(0(1)10))
marginsplot, yline(0) title(AMEs of Trust with 95% CIs)

eststo:logit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

margins, dydx(satSC) at(immigration=(0(1)10))
marginsplot, yline(0) title(AMEs of Performance Satisfaction with 95% CIs)

eststo:logit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

margins, dydx(stateHEALTH) at(immigration=(0(1)10))
marginsplot, yline(0) title(AMEs of State of Health with 95% CIs)

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

margins, dydx(stateEDU) at(immigration=(0(1)10))
marginsplot, yline(0) title(AMEs of State of Education with 95% CIs)

graph combine "Trustmargins" "perfmargins" "stateHEALTHmargins" "stateEDUmargins"

estimates table M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)

 
***********APPENDIX***********
 
 
*******APPENDIX FIGURE 1*****************
** far right voters 

bysort immigration: egen mean_trust_by_immigration1 = mean(trust) if vright==1
 twoway (connected mean_trust_by_immigration1 immigration) 
 addplot: hist immigration if vright==1, percent fcolor(none) lcolor(red) leg(off)
 
 bysort immigration: egen mean_satSC_by_immigration1 = mean(satSC) if vright==1
twoway (connected mean_satSC_by_immigration1 immigration)
 addplot: hist immigration if vright==1, percent fcolor(none) lcolor(red) leg(off)

bysort immigration: egen mean_stateHEALTH_by_immigration1 = mean(stateHEALTH) if vright==1
twoway (connected mean_stateHEALTH_by_immigration1 immigration)
 addplot: hist immigration if vright==1, percent fcolor(none) lcolor(red) leg(off)

bysort immigration: egen mean_stateEDU_by_immigration1 = mean(stateEDU) if vright==1
twoway (connected mean_stateEDU_by_immigration1 immigration)
 addplot: hist immigration if vright==1, percent fcolor(none) lcolor(red) leg(off)


**non far right voters 

bysort immigration: egen mean_trust_by_immigration0 = mean(trust) if vright==0
 twoway (connected mean_trust_by_immigration0 immigration)
  addplot: hist immigration if vright==0, percent fcolor(none) lcolor(red) leg(off)

 bysort immigration: egen mean_satSC_by_immigration0 = mean(satSC) if vright==0
twoway (connected mean_satSC_by_immigration0 immigration)
 addplot: hist immigration if vright==0, percent fcolor(none) lcolor(red) leg(off)

bysort immigration: egen mean_stateHEALTH_by_immigration0 = mean(stateHEALTH) if vright==0
twoway (connected mean_stateHEALTH_by_immigration0 immigration)
 addplot: hist immigration if vright==0, percent fcolor(none) lcolor(red) leg(off)

bysort immigration: egen mean_stateEDU_by_immigration0 = mean(stateEDU) if vright==0
twoway (connected mean_stateEDU_by_immigration0 immigration)
 addplot: hist immigration if vright==0, percent fcolor(none) lcolor(red) leg(off)
 
graph combine "G1" "G2" "G3" "G4"

graph combine "G5" "G6" "G7" "G8"


**** **** Interactions + slope plots for FIGURES 2a-2d IN APPENDIX

eststo:logit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround

margins, at(trust=(1 10) immigration=(0(1)10))
marginsplot, noci x(trust) recast(line) xlabel(1(1)10)

eststo:logit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround

margins, at(satSC=(1 10) immigration=(0(1)10))
marginsplot, noci x(satSC) recast(line) xlabel(1(1)10)

eststo:logit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround

margins, at(stateHEALTH=(1 10) immigration=(0(1)10))
marginsplot, noci x(stateHEALTH) recast(line) xlabel(1(1)10)

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround

 margins, at(stateEDU=(1 10) immigration=(0(1)10))
marginsplot, noci x(stateEDU) recast(line) xlabel(1(1)10)

*****PREDICTED PROBABILITIES MODELS 1-4 for FIGURE 3 IN APPENDIX 

*TRUST 
logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, dydx(*) post

logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, at(trust=(0(1)10)) atmeans post
marginsplot

*PERFORMANCE SATISFACTION

logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, dydx(*) post

logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, at(satSC=(0(1)10)) atmeans post
marginsplot

*HEALTH

logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, dydx(*) post

logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, at(stateHEALTH=(0(1)10)) atmeans post
marginsplot

*EDUCATION

logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, dydx(*) post

logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
margins, at(stateEDU=(0(1)10)) atmeans post
marginsplot

*one marginplot //FIGURE 3 IN APPENDIX

eststo clear
	
 quietly logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
 quietly eststo Trust: margins, at(trust=(0(1)10)) atmeans post

 quietly logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
 quietly eststo Performance_Satisfaction: margins, at(satSC=(0(1)10)) atmeans post
 
 quietly logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
 quietly eststo Health: margins, at(stateHEALTH=(0(1)10)) atmeans post
 
 quietly logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
 quietly eststo Education: margins, at(stateEDU=(0(1)10)) atmeans post


 
coefplot Trust Performance_Satisfaction Health Education, at ytitle(Pr(Far right vote)) xtitle(Evaluations of the Democratic Process) ///
 recast(line) lwidth(*1) ciopts(recast(rline) lpattern(dash))
 
 
***FIGURE 4 IN APPENDIX***
egen z_satSC=std(satSC)
egen z_stateEDU=std(stateEDU)
egen z_stateHEALTH=std(stateHEALTH)
egen z_trust=std(trust)
egen z_feelincome=std(feelincome)
egen z_unemployed=std(unemployed) 
egen z_immigration=std(immigration) 
egen z_agea=std(agea)
egen z_eduyrs=std(eduyrs) 
egen z_male=std(male)
egen z_urban=std(urban) 
egen z_lrscale=std(lrscale) 
egen z_countryround=std(countryround) 

logit vright c.z_immigration c.z_unemployed c.z_agea c.z_eduyrs c.z_male c.z_countryround

coefplot, ///
	drop(_cons z_countryround) ///
	xline(0) ///
	coeflabels(z_immigration="Pro-immigr" z_unemployed="Unemployed" z_agea="Age" z_eduyrs="Eduyrs" z_male="Male") ///
	graphregion(color(white) lwidth(large)) ///
	grid(none) 
	
**FIGURE 5 IN APPENDIX - effect of each immigration value on vright***


logit vright c.immigration unemployed c.agea c.eduyrs male i.countryround
margins, at(immigration=(0(1)10))
marginsplot

***FIGURE 6 IN APPENDIX 

hist immigration if vright==1

 
****DESCRIPTIVE STATISTICS TABLE 2 IN APPENDIX***********

eststo clear
estpost sum vright trust satSC stateHEALTH stateEDU feelincome unemployed immigration agea eduyrs male urban lrscale 


***ROBUSTNESS: only Western Europe Table 4 IN APPENDIX**********
 
keep if cntry=="AT" | cntry=="BE" | cntry=="CY" | cntry=="CH" | cntry=="DE" | cntry=="DK" | cntry=="FI" | cntry=="FR" | cntry=="GB" | cntry=="GR" | cntry=="IT" | cntry=="NL" | cntry=="NO" | cntry=="SE" | cntry=="PT" | | cntry=="EE" 

eststo clear

eststo:logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)

 
**ROBUSTNESS: PARTY FEEL CLOSE TO TABLE 5 IN APPENDIX**********

local varlist prtclat - prtcldsk
gen fclose=.
replace fclose=1 if prtclat==3 | prtclaat==3 | prtclcat==3 |prtclaat==4 | prtclcat==4 | prtclbe==8 | prtclabe==8 | prtclbbe==8 | prtclcbe==7 | prtclbe==15 | prtclabe==12 | prtclbbe==12| prtclcbe==11 | prtclbg==7 | prtclabg==11  | prtclbbg==3 | prtcldk==6 | prtcladk==6 | prtclbdk==5 | prtclcdk==5| prtclafi==5 | prtclbfi==5 | prtclcfi==4 | prtcldfi==4 | prtclfr==3 | prtclafr==2 | prtclbfr==2 | prtclcfr==1 | prtcldfr==2 | prtclefr==2 | prtclfr==7 | prtclafr==6 | prtclede==6 | prtclbgr==5 | prtclcgr==4 | prtclcgr==12 |  prtclchu==11 | prtcldhu==7 | prtclehu==4 | prtclfhu==4 | prtclit==11 | prtclcit==3 | prtclit==9 | prtclit==16 | prtcllt==14| prtclalt==9 | prtclblt==6 | prtclnl==4 | prtclanl==4 | prtclcnl==3 | prtcldnl==3 | prtclenl==3 | prtclno==8 | prtclano==8 | prtclbno==8 | prtclpl==11 | prtclapl==15 | prtclbpl==15 | prtclcpl==5 | prtcldpl==7 | prtclepl==5 | prtclfpl==5 | prtclgpl==6 | prtclgpl==1 | prtclepl==1 | prtclfpl==1 | prtclpl==4 |  prtclapl==7 | prtclbpl==4 | prtclcpl==1 | prtcldpl==1 | prtclask==6 | prtclasi==6 | prtclbsi==4 | prtclcsi==7 | prtclase==10 | prtclbse==10 | prtclch==4 | prtclach==4 | prtclbch==4 | prtclcch==4 | prtcldch==1 | prtclech==1 | prtclfch==1 | prtclch==11 | prtclach==11 | prtclbch==10 | prtclcch==10 | prtcldch==15 | prtclbgb==7 | prtcldat==3 | prtcldbe==7 | prtcldbe==11 | prtcldbg==3 | prtclbcy==4 | prtclecz==8 | prtclddk==5 | prtclgee==6 | prtclefi==4 | prtclffr==11 | prtclede==6 | prtclghu==3 |prtclghu==4 | prtcldit==9 | prtcldit==10 | prtclfnl==3 | prtclhpl==5 | prtclcsi==7 | prtclfes==16 | prtclcse==9 | prtclgch==1 | prtclcgb==7 | prtclfsi==11 

foreach var of varlist prtclat - prtcldsk {
replace fclose=0 if `var'!=. & fclose !=1
}

tab fclose

***no attaka 2018**no 2018 slovakian party

eststo clear

eststo:logit fclose c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit fclose c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit fclose c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit fclose c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit fclose c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit fclose c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit fclose c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit fclose c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit fclose c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit fclose c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit fclose c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)


***ROBUSTNESS MULTI LEVEL MODELS TABLE 6 IN APPENDIX**********

*Multi-level models M1-11 

 eststo clear
 
 eststo:xtmelogit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale || countryround:, var
estat ic
estimates store M1

eststo:xtmelogit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale || countryround:, var
estat ic
estimates store M2

eststo:xtmelogit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale || countryround:, var
estat ic
estimates store M3

eststo:xtmelogit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale || countryround:, var
estat ic
estimates store M4

eststo:xtmelogit vright c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale || countryround:, var
estat ic
estimates store M5

eststo:xtmelogit vright c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale || countryround:, var
estat ic
estimates store M6

eststo:xtmelogit vright c.trust c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale || countryround:, var
estat ic
estimates store M7

 eststo:xtmelogit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale || countryround:, var
  estat ic
  
  estimates store M8
 
 eststo:xtmelogit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale || countryround:, var
 estat ic
 
 estimates store M9
 
  eststo:xtmelogit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale || countryround:, var
 estat ic
 
 estimates store M10

eststo:xtmelogit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale || countryround:, var

 estat ic
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)


***COUNTRY MODELS: TABLES 7a-g IN APPENDIX**********

*****Austria     
 
keep if cntry=="AT" 
*DV FPO 
local varlist prtvtat - prtvtdsk
gen vrightFPO=.
replace vrightFPO=1 if prtvtat==3 
replace vrightFPO=1 if prtvtaat==3
replace vrightFPO=1 if prtvtbat==3
replace vrightFPO=1 if prtvtcat==3


foreach var of varlist prtvtat - prtvtdsk {
replace vrightFPO=0 if `var'!=. & vrightFPO !=1
}


label variable vrightFPO "voted far-right in the last election"

tab vrightFPO

 
eststo clear

eststo:logit vrightFPO c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vrightFPO c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vrightFPO c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vrightFPO c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vrightFPO c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vrightFPO c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vrightFPO c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vrightFPO c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vrightFPO c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vrightFPO c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vrightFPO c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)



*****Belgium    
 
keep if cntry=="BE" 
 
eststo clear

eststo:logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)


 
 *****France 
 
keep if cntry=="FR" 
*vote FN 
 
 local varlist prtvtat - prtvtdsk
gen vrightFN=.
replace vrightFN=1 if prtvtfr==3
replace vrightFN=1 if prtvtafr==3
replace vrightFN=1 if prtvtbfr==2
replace vrightFN=1 if prtvtcfr==2
replace vrightFN=1 if prtvtdfr==11
foreach var of varlist prtvtat - prtvtdsk {
replace vrightFN=0 if `var'!=. & vrightFN !=1
}

label variable vrightFN "voted far-right in the last election"

tab vrightFN

eststo clear

eststo:logit vrightFN c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vrightFN c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vrightFN c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vrightFN c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vrightFN c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vrightFN c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vrightFN c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vrightFN c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vrightFN c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vrightFN c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vrightFN c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)



 *****Norway   
 
keep if cntry=="NO" 
 
eststo clear

eststo:logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)

 
 
 *****Switzerland  
 
 *DV SVP
 keep if cntry=="CH" 
 
local varlist prtvtat - prtvtdsk
gen vrightSVP=.
replace vrightSVP=1 if prtvtch==4 
replace vrightSVP=1 if prtvtach==4
replace vrightSVP=1 if prtvtbch==4
replace vrightSVP=1 if prtvtcch==4
replace vrightSVP=1 if prtvtdch==1
replace vrightSVP=1 if prtvtech==1
replace vrightSVP=1 if prtvtfch==1
replace vrightSVP=1 if prtvtgch==1

foreach var of varlist prtvtat - prtvtdsk {
replace vrightSVP=0 if `var'!=. & vrightSVP !=1
}

label variable vrightSVP "voted far-right in the last election"

tab vrightSVP
 
eststo clear

eststo:logit vrightSVP c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vrightSVP c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vrightSVP c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vrightSVP c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vrightSVP c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vrightSVP c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vrightSVP c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vrightSVP c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vrightSVP c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vrightSVP c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vrightSVP c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)

 
***Poland    
 keep if cntry=="PL" 

 local varlist prtvtat - prtvtdsk
gen vrightPiS=.
replace vrightPiS=1 if prtvtpl==5
replace vrightPiS=1 if prtvtapl==14
replace vrightPiS=1 if prtvtbpl==6
replace vrightPiS=1 if prtvtcpl==6
replace vrightPiS=1 if prtvtdpl==6 
foreach var of varlist prtvtat - prtvtdsk {
replace vrightPiS=0 if `var'!=. & vrightPiS !=1
}

label variable vrightPiS "voted far-right in the last election"

tab vrightPiS
 
 
eststo clear

eststo:logit vrightPiS c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vrightPiS c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vrightPiS c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vrightPiS c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vrightPiS c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vrightPiS c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vrightPiS c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vrightPiS c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vrightPiS c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vrightPiS c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vrightPiS c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)

 
**HUNGARY only Fidesz (last round)

 gen vrightFidesz=.
replace vrightFidesz =1 if  prtvtfhu==3

foreach var of varlist prtvtfhu {
replace vrightFidesz=0 if `var'!=. & vrightFidesz !=1
}

sum vrightFidesz
tab vrightFidesz


eststo clear

eststo:logit vrightFidesz c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vrightFidesz c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vrightFidesz c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vrightFidesz c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vrightFidesz c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vrightFidesz c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vrightFidesz c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vrightFidesz c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vrightFidesz c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vrightFidesz c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vrightFidesz c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)

 
***ROBUSTNESS p-value 0.001 TABLE 8 IN APPENDIX**********
 
eststo clear

eststo:logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)



***ROBUSTNESS run without economic grievance only unemployment TABLE 9 IN APPENDIX**********
 
 eststo clear

eststo:logit vright c.trust unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.satSC unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust c.satSC unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust c.satSC c.stateHEALTH unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU  unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vright c.trust##c.immigration c.satSC c.stateHEALTH c.stateEDU unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vright c.trust c.satSC##c.immigration c.stateHEALTH c.stateEDU unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vright c.trust c.satSC c.stateHEALTH##c.immigration c.stateEDU unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vright c.trust c.satSC c.stateHEALTH c.stateEDU##c.immigration unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11


estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)



***ROBUSTNESS trust without police + legal system TABLE 10 IN APPENDIX**********
 
*Trust in domestic institutions // parliament // legal system // police // politicians // political parties 
*alpha trstprl trstlgl trstplc trstplt trstprt --> Cronbach's alpha =  0.9
sumscale, f4(trstprl trstplt trstprt)
gen trust2=Factor4_average // high = trust
sum trust2
label var trust2 "Trust2"

 
eststo clear

eststo:logit vright c.trust2 i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust2 c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust2 c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust2 c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vright c.trust2##c.immigration c.satSC c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vright c.trust2 c.satSC##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vright c.trust2 c.satSC c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vright c.trust2 c.satSC c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)



 *ROBUSTNESS satisfaction with democracy TABLE 11 IN APPENDIX**********
 *stfdem
 
 
eststo clear

eststo:logit vright c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.stfdem i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust c.stfdem i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust c.stfdem c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright c.trust c.stfdem c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

eststo:logit vright c.trust##c.immigration c.stfdem c.stateHEALTH c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

eststo:logit vright c.trust c.stfdem##c.immigration c.stateHEALTH c.stateEDU i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M9

eststo:logit vright c.trust c.stfdem c.stateHEALTH##c.immigration c.stateEDU i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M10

eststo:logit vright c.trust c.stfdem c.stateHEALTH c.stateEDU##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M11

estimates table M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11, b(%7.3f) se(%7.3f) stats(N r2)



*** Far right in government as a DV TABLE 12 IN APPENDIX**********

**gov-opposition 
**data from http://www.parlgov.org/

*FPO R1 + R2 + R8
*True Finns R8
*Fidesz R9
*LN R1 + R9
*AN R1 
*Lithuania TT R6 + R7 + R9
*FrP R7 + R8 + R9 
*PiS R3 + R8 + R9 
*LPR R3 
*SNS-Slovakia R3 + R4 + R9 
*SVP R1-R9 

local varlist prtvtat - prtvtdsk
gen vright_gov=.
replace vright_gov=1 if prtvtat==3 /*austriaFPO R1 + R2*/
replace vright_gov=1 if prtvtbat==4 & essround==8 /*austriaFPO R8*/
replace vright_gov=1 if prtvtdfi==4 & essround==8 /*True Finns R8*/
replace vright_gov=1 if prtvtfhu==3/*Fidesz R9*/
replace vright_gov=1 if prtvtit==11 /*Italy LN R1*/
replace vright_gov=1 if prtvtcit==9 /*Italy LN R9*/
replace vright_gov=1 if prtvtit==9 /*Italy AN R1*/
replace vright_gov=1 if prtvalt1==9 /* Lithuania TT R6 + R7*/
replace vright_gov=1 if prtvalt2==9 /* Lithuania TT R6 + R7 second vote*/
replace vright_gov=1 if prtvblt1==5 & essround==9 /*Lithuania TT R9e*/
replace vright_gov=1 if prtvblt2==6 & essround==9 /*Lithuania TT R9e second vote*/
replace vright_gov=1 if prtvtbno==8 /*FrP R7 + R8 + R9*/
replace vright_gov=1 if prtvtapl==14 /*PiS R3*/
replace vright_gov=1 if  prtvtdpl==6 /*PiS R8 + R9 */
replace vright_gov=1 if prtvtapl==3 /*LPR R3 */
replace vright_gov=1 if prtvtask==6 /*SNS-Slovakia R3 + R4*/
replace vright_gov=1 if prtvtdsk==2 /*SNS-Slovakia R9*/
replace vright_gov=1 if prtvtch==4 /*SVP R1+2*/
replace vright_gov=1 if prtvtach==4/*SVP R3*/
replace vright_gov=1 if prtvtbch==4  /*SVP R4*/
replace vright_gov=1 if prtvtcch==4 /*SVP R5*/
replace vright_gov=1 if prtvtdch==1  /*SVP R6*/
replace vright_gov=1 if prtvtech==1 /*SVP R7*/
replace vright_gov=1 if prtvtfch==1 /*SVP R8*/
replace vright_gov=1 if prtvtgch==1 /*SVP R9*/
  
  
foreach var of varlist prtvtat - prtvtdsk {
replace vright_gov=0 if `var'!=. & vright_gov !=1
}

label variable vright_gov "far-right in government"

tab vright_gov

eststo clear

eststo:logit vright_gov c.trust i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright_gov c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright_gov c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright_gov c.stateEDU i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright_gov c.trust c.satSC i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright_gov c.trust c.satSC c.stateHEALTH i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M6

eststo:logit vright_gov c.trust c.satSC c.stateHEALTH c.stateEDU  i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M7

estimates table M1 M2 M3 M4 M5 M6 M7, b(%7.3f) se(%7.3f) stats(N r2)



***three factors as independent variables: trust, performance, policy TABLE 13 IN APPENDIX**********
**create factor variables 
 
 *trust

factor trstprl trstlgl trstplc trstplt trstprt, pcf
predict trust_factor

*performance 
factor stfeco stfgov stfdem, pcf
predict performance_factor

* policy 

factor stateHEALTH stateEDU, pcf
predict policy_factor

 
 eststo clear

eststo:logit vright c.trust_factor i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M1

eststo:logit vright c.performance_factor i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M2

eststo:logit vright c.policy_factor i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M3

eststo:logit vright c.trust_factor c.performance_factor i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M4

eststo:logit vright c.trust_factor c.performance_factor c.policy_factor i.feelincome unemployed c.immigration c.agea c.eduyrs male urban c.lrscale  i.countryround
estimates store M5

eststo:logit vright c.trust_factor##c.immigration c.performance_factor c.policy_factor i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M6

eststo:logit vright c.trust_factor c.performance_factor##c.immigration c.policy_factor i.feelincome unemployed  c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M7

eststo:logit vright c.trust_factor c.performance_factor c.policy_factor##c.immigration i.feelincome unemployed c.agea c.eduyrs male urban c.lrscale i.countryround
estimates store M8

estimates table M1 M2 M3 M4 M5  M6 M7 M8, b(%7.3f) se(%7.3f) stats(N r2)

 